<?php
/**
 * @copyright	Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
 * Joomla! is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
$document   = &JFactory::getDocument();
$renderer   = $document->loadRenderer( 'modules' );
$raw = array( 'style' => 'raw' );
$xhtml = array( 'style' => 'raw' );

// change this to whatever email address you want the notifications to be sent to
$emailaddress = "matt@betweenbrain.com";

// only change this number if you plan on making other error pages.. eg. 403, 500, etc..
$errorNum = "404";

// message area - you can stop the emailing of error notices by commented out each of the lines below
$errortime = (date("M d Y h:m:s"));
$message .= $errorNum." Error Report\r\n\r\nA ".$errorNum." error was encountered by ".$_SERVER['REMOTE_ADDR'];
$message .= " on $errortime.\r\n\r\n";
$message .= "The URL which generated the 404 error is: \nhttp://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."\r\n\r\n";
$message .= "The referring page, if any, was:\n".$_SERVER['HTTP_REFERER']."\r\n\r\n";
$message .= "The used client was:\n".$_SERVER['HTTP_USER_AGENT']."\r\n\r\n";
$headers = "From: ".$emailaddress."\nDate: ".$errortime." +0100\n";
$subject = "Error: ".$errorNum." from ".$_SERVER['HTTP_REFERER'];
mail($emailaddress, $subject, $message, $headers);
								
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
	<title><?php echo $this->error->code ?> - <?php echo $this->title; ?></title>
	<meta name="mssmarttagspreventparsing" content="true" />
	<meta http-equiv="imagetoolbar" content="no" />
	<link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/styles[compressed-wide].css" rel="stylesheet" type="text/css" media="screen" />
	<link rel="alternate stylesheet" type="text/css" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/narrow.css" title="narrow" media="screen" />
	<link rel="alternate stylesheet" type="text/css" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/wide.css" title="wide" media="screen" />
	<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/javascript/styleswitch.js"></script>
	<script type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/javascript/SlidingFontResizer.js"></script>
	<![if !(IE 6)]>
	<script type="text/javascript">
		<!--//
		window.addEvent('domready', function() {
			var resizer = new SlidingFontResizer($('resizer'), {
			targetArea: '<?php echo $style ;?>', 
			minSize: 12, 
			maxSize: 18, 
			showValuePanel: true
			});			
		});
		//-->
	</script>
	<![endif]>
</head>
<body id="both">
	<div id="container">
		<ul id="access"> 
			<span id="resizer">I'm a resizer!</span>  
			<li class="narrow"><a href="#" onclick="setActiveStyleSheet('narrow'); return false;" title="Narrow">narrow</a></li>
			<li class="wide"><a href="#" onclick="setActiveStyleSheet('wide'); return false;" title="Wide">wide</a></li>
		</ul>
		<div id="header" class="clr clearfix">
			<div id="branding">
				<h1><a href="<?php echo $this->baseurl ?>/" title="<?php echo $this->baseurl ?>/"><?php echo $this->baseurl ?></a></h1>
			</div><!-- end branding -->
			<div id="top-module">
				<?php  echo $renderer->render( 'top', $xhtml, null);  ?>
			</div><!-- end top-module -->
		</div><!-- end header -->
		
		<div id="breadcrumbs">
			<p>You are here: <?php  echo $renderer->render( 'breadcrumb', $raw, null);  ?></p>
		</div><!-- end breadcrumbs -->
		
		
		
		<div id="nav" class="clr">    
			<?php  echo $renderer->render( 'navigation', $raw, null);  ?>
		</div>
		
		<div id="body-content" class="clr clearfix">  
			<div id="top-user-modules" class="clearfix">
				<div class="inside">
					<div id="user1" class="count4">
						<div class="inside">
							<?php  echo $renderer->render( 'user1', $xhtml, null);  ?>
						</div><!-- end inside -->
					</div><!-- end user1 -->     
					<div id="user2" class="count4">
						<div class="inside">
							<?php  echo $renderer->render( 'user2', $xhtml, null);  ?>
						</div><!-- end inside -->
					</div><!-- end user2 -->     
					<div id="user3" class="count4">
						<div class="inside">
							<?php  echo $renderer->render( 'user3', $xhtml, null);  ?>
						</div><!-- end inside -->
					</div><!-- end user3 -->
					<div id="user4" class="count4">
						<div class="inside">
							<?php  echo $renderer->render( 'user4', $xhtml, null);  ?>
						</div><!-- end inside -->
					</div><!-- end user4 -->    
				</div><!--end inside-->		
			</div><!-- end top-user-modules -->  
			
			<div id="load-first" class="clearfix">
				<div id="middle-column">
					<div class="inside">      
						<a id="content" name="content"></a>        
						<div id="main-body">
							<center>
								<?php echo $this->error->code ?> - <?php echo $this->error->message ?>
								<p><strong><?php echo JText::_('You may not be able to visit this page because of:'); ?></strong></p>
								<ol>
									<li><?php echo JText::_('An out-of-date bookmark/favourite'); ?></li>
									<li><?php echo JText::_('A search engine that has an out-of-date listing for this site'); ?></li>
									<li><?php echo JText::_('A mis-typed address'); ?></li>
									<li><?php echo JText::_('You have no access to this page'); ?></li>
									<li><?php echo JText::_('The requested resource was not found'); ?></li>
									<li><?php echo JText::_('An error has occurred while processing your request.'); ?></li>
								</ol>
								<p><strong><?php echo JText::_('Please try one of the following pages:'); ?></strong></p>
								<p>
									<ul>
										<li><a href="<?php echo $this->baseurl; ?>/" title="<?php echo JText::_('Go to the home page'); ?>"><?php echo JText::_('Home Page'); ?></a></li>
									</ul>
								</p>
								<p><?php echo JText::_('If difficulties persist, please contact the system administrator of this site.'); ?></p>
								<p><?php echo $this->error->message; ?></p>
								<p>
								<?php if($this->debug) :
								echo $this->renderBacktrace();
								endif; ?>
								</p>
							</center>
						</div><!--end main-body-->
					</div><!-- end inside -->
				</div><!-- end middle-column -->         
				
				<div id="left">
					<div class="inside">     
						<?php  echo $renderer->render( 'left', $xhtml, null);  ?>
					</div><!-- end inside -->
				</div>  
			
			</div><!--end load-first-->
			
			<div id="right">
				<div class="inside">     
					<?php  echo $renderer->render( 'rightt', $xhtml, null);  ?>
				</div><!-- end inside -->
			</div> 
			
			
			<div id="bottom-user-modules" class="clearfix">      
				<div class="inside">		
					<div id="user5" class="count4">
						<div class="inside">
							<?php  echo $renderer->render( 'user5', $xhtml, null);  ?>
						</div><!-- end inside -->
					</div><!-- end user5 -->
					<div id="user6" class="count4">
						<div class="inside">
							<?php  echo $renderer->render( 'user6', $xhtml, null);  ?>
						</div><!-- end inside -->
					</div><!-- end user6 -->
					<div id="user7" class="count4">
						<div class="inside">
							<?php  echo $renderer->render( 'user7', $xhtml, null);  ?>
						</div><!-- end inside -->
					</div><!-- end user8 -->
					<div id="user8" class="count4">
						<div class="inside">
							<?php  echo $renderer->render( 'user8', $xhtml, null);  ?>
						</div><!-- end inside -->
					</div><!-- end user8 -->
				</div><!-- end inside -->      
			</div><!-- end bottom-user-modules -->   
		</div><!-- end body-content -->    
		
		
		<div id="footer" class="clearfix">
			<div class="inside">
				<?php  echo $renderer->render( 'footer', $xhtml, null);  ?>
				<div id="backtotoplink">
					<a href="<?php echo $this->baseurl ?>#top" class="to-additional">Back to Top</a>
				</div>    
			</div><!-- end inside -->
		</div><!-- end footer -->    
	</div><!-- end container --> 
</body>
</html>